<template>
  <keep-alive>
    <polify-list v-if="currentComponent === 'PolifyList'" :setComponent="setComponent" :setCurrentPolicyDetail="setCurrentPolicyDetail"></polify-list>
    <policy-details v-else :setComponent="setComponent" :currentPolicyDetail="currentPolicyDetail"></policy-details>
  </keep-alive>
</template>

<script setup>
import { ref } from 'vue'
import PolifyList from './polifyList/index.vue'
import PolicyDetails from './policyDetails/index.vue'

// 当前显示的组件
const currentComponent = ref('PolifyList')
// 修改当前显示的组件
const setComponent = (value) => {
  currentComponent.value = value
}
// 给子组件的政策id
const currentPolicyDetail = ref('')
// 修改政策id
const setCurrentPolicyDetail = (value) => {
  currentPolicyDetail.value = value
}
</script>